
<div id="sub_nav">
      <p>Quick Links:</p>
      <ul>
        <li></li>

      </ul>
    </div>
<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/salestaxes/index" title="Manage Admin">Sales Tax</a></li>

    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left">

    <!-- begin all content here -->

    <br class="clear" />

    <!-- success --><!-- error -->
    <?php
    echo $this->Session->flash();
    if ($this->Session->check('Message.auth'))
        echo $this->Session->flash('auth');
    ?>
    <div class="div_header"><?php __('Sales Tax'); ?></div>
    <div class="div_content">
        <div>Use the Sales Tax table to enter tax rate you want to charge for each state, leave the field blank if you don't want to charge to specific state. Optionally, you
can indicate whether you want to charge Sales Tax for Shipping and Handling.
        </div>
        <div style="background:#ccc;font-size: 15px; color: black; height: 26px; vertical-align: middle; padding-top: 4px; padding-left: 3px;">Currently Sales Tax applied on:</div>
           <table id="category_table" cellspacing="0" class="tablesorter">
            <thead>
                <tr>
                    <th width="50" ><?php echo _('State'); ?></th>
                    <th width="120" ><?php echo _('Sales Tax Rate'); ?></th>
                    <th width="120" ><?php echo _('Sales Tax applied on'); ?></th>
                    <th width="70" >Actions</th>

                </tr>
            </thead>
            <tbody>
                <?php
                $i = 0;
                //pr($category);
                foreach ($salestaxes as $salestax):
                    $class = null;
                    if ($i++ % 2 == 0) :
                        $class = ' class="alt"';
                ?>
                        <tr>
                            <td class="alt"><?php echo $salestax['State']['state']; ?></td>
                            <td class="alt"><?php echo $salestax['Salestax']['rate']; ?>  </td>
                            <td class="alt"><?php if($salestax['Salestax']['taxappliedon']==1)
                                                     echo "Product, Shipping & Handling";
                                                    else echo "Product";
                                                    ?>
                            </td>
                       <td align="center" class="alt">
                       <a href="javascript:void(0);" controller="salestaxes" action="edit" title="Edit" ElmID="<?php echo $salestax['Salestax']['id']; ?>" onclick='showPop(this)'>
<?php echo $this->Html->image("edit_gray.png", array("alt" => "Edit", 'border' => '0')); ?>
                        </a>&nbsp;&nbsp;
                        <?php
                        echo $this->Html->link(
                                $this->Html->image("delete_gray.png", array("alt" => "Delete", 'border' => '0')),
                                array('action' => 'delete', $salestax['Salestax']['id']),
                                array('escape' => false), sprintf(__('Are you sure you want to delete this Tax?', true), $salestax['Salestax']['id'])
                        );
                        ?>
                    </td>

                </tr>
<?php else: ?>
                            <tr>
                                  <td ><?php echo $salestax['State']['state']; ?></td>
                            <td ><?php echo $salestax['Salestax']['rate']; ?>  </td>
                            <td ><?php if($salestax['Salestax']['taxappliedon']==1)
                                                     echo "Product, Shipping & Handling";
                                                    else echo "Product";
                                                    ?>   </td>
                    <td align="center">
                       <a href="javascript:void(0);" controller="salestaxes" action="edit" title="Edit" ElmID="<?php echo $salestax['Salestax']['id']; ?>" onclick='showPop(this)'>
<?php echo $this->Html->image("edit_yellow.png", array("alt" => "Edit", 'border' => '0')); ?>
                        </a>&nbsp;&nbsp;
                        <?php
                        echo $this->Html->link(
                                $this->Html->image("delete_red.png", array("alt" => "Delete", 'border' => '0')),
                                array('action' => 'delete', $salestax['Salestax']['id']),
                                array('escape' => false), sprintf(__('Do you really want to Delete this tax?', true))
                        );
                        ?>
                    </td>

                </tr>
<?php endif;
                        endforeach; ?>
                    <tbody>
                </table>
        <div class="paging">
		<div style="background:#ccc;font-size: 15px; color: black; height: 26px; vertical-align: middle; padding-top: 4px; padding-left: 3px;">
                    Add Sales Tax
                </div>
            <div>
                <form method="post" id="suspendfrm" action="<?php echo Configure::read('base_url')."backstage/salestaxes/add"; ?>" enctype="multipart/form-data">
    <table cellspacing="0" width="100%">
        <tbody>
             <tr>
                <td>
                    Apply
                <?php
                 echo $this->Form->input('Salestax.rate',array('div'=>false,'label'=>false,'size'=>10,'class'=>'required','style'=>'text-align:right;'));
                 ?>&nbsp;&nbsp;%
                 </td>
                 <td>
                    Sales Tax on
                 <?php echo $this->Form->input('Salestax.state_id',array('empty'=>'--Select State--','div'=>false,'label'=>false,'class'=>'required'));?>
                 </td>
                 <td>
                 <?php 
                 echo $this->Form->input('Salestax.taxappliedon',array('type'=>'checkbox','div'=>false,'label'=>false));
                 ?>
                     Also,apply sales tax to shipping & handling
                 </td>
                <td colspan="2" align="left">
                 <input type="submit" style="background:#73AE0B; color:#fff; font-size:14px;" name="button" id="button" value="Add" />
                 
                </td>
            </tr>
        </tbody>
    </table>
        </form></div>
	</div>
            </div>
            <div class="div_bottom"></div>
        </div>

        <!-- edit sidebar items here -->

        </div>
<?php echo $this->Html->css('table_css');?>

<?php echo $html->script(array("jquery.pagination.js", "jquery.tablesorter.min.js", "jquery.tablednd.js","jquery.validate.js")); ?>
<script type="text/javascript">

    jQuery(document).ready(function(){
        jQuery("#category_table").tablesorter({headers: {3:{sorter: false}, 4:{sorter: false}}});
        var v = jQuery("#suspendfrm").validate({
                            
                       });
    });
</script>